<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>ESP8266_RTOS_SDK: Smartconfig APIs</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">ESP8266_RTOS_SDK
   &#160;<span id="projectnumber">v1.4.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Smartconfig APIs<div class="ingroups"><a class="el" href="group__WiFi__APIs.html">WiFi Related APIs</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>SmartConfig APIs.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ga98fdb334fead4d1bd026b9ceee8c3db0"><td class="memItemLeft" align="right" valign="top">typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__Smartconfig__APIs.html#ga98fdb334fead4d1bd026b9ceee8c3db0">sc_callback_t</a>) (<a class="el" href="group__Smartconfig__APIs.html#gafec33e52eaa14ed795ab28ce69c685e3">sc_status</a> status, void *pdata)</td></tr>
<tr class="memdesc:ga98fdb334fead4d1bd026b9ceee8c3db0"><td class="mdescLeft">&#160;</td><td class="mdescRight">The callback of SmartConfig, executed when smart-config status changed.  <a href="#ga98fdb334fead4d1bd026b9ceee8c3db0">More...</a><br /></td></tr>
<tr class="separator:ga98fdb334fead4d1bd026b9ceee8c3db0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:gafec33e52eaa14ed795ab28ce69c685e3"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__Smartconfig__APIs.html#gafec33e52eaa14ed795ab28ce69c685e3">sc_status</a> { <br />
&#160;&#160;<a class="el" href="group__Smartconfig__APIs.html#ggafec33e52eaa14ed795ab28ce69c685e3a3de75e54ab5d15e0aa697d2d35adc363">SC_STATUS_WAIT</a> = 0, 
<a class="el" href="group__Smartconfig__APIs.html#ggafec33e52eaa14ed795ab28ce69c685e3a30fee0de55f059ac14821f8e2b22ac03">SC_STATUS_FIND_CHANNEL</a>, 
<a class="el" href="group__Smartconfig__APIs.html#ggafec33e52eaa14ed795ab28ce69c685e3aefc9b644b16531defe122b7316cea0c0">SC_STATUS_GETTING_SSID_PSWD</a>, 
<a class="el" href="group__Smartconfig__APIs.html#ggafec33e52eaa14ed795ab28ce69c685e3aae1dcaae9b8358bd43499bbca2e0bf95">SC_STATUS_LINK</a>, 
<br />
&#160;&#160;<a class="el" href="group__Smartconfig__APIs.html#ggafec33e52eaa14ed795ab28ce69c685e3a1ae1253a12888c150c36cd30f56394dc">SC_STATUS_LINK_OVER</a>
<br />
 }<tr class="separator:gafec33e52eaa14ed795ab28ce69c685e3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</td></tr>
<tr class="memitem:ga533261c0af94cdbb04fe90f452af9b9d"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__Smartconfig__APIs.html#ga533261c0af94cdbb04fe90f452af9b9d">sc_type</a> { <a class="el" href="group__Smartconfig__APIs.html#gga533261c0af94cdbb04fe90f452af9b9dabae45491cc05b00bd1b069bb61e37b01">SC_TYPE_ESPTOUCH</a> = 0, 
<a class="el" href="group__Smartconfig__APIs.html#gga533261c0af94cdbb04fe90f452af9b9da6254d899f4bf164fdb0f3dd778c206e9">SC_TYPE_AIRKISS</a>, 
<a class="el" href="group__Smartconfig__APIs.html#gga533261c0af94cdbb04fe90f452af9b9da50e8065c00b088cdb87b8b0ded4a853c">SC_TYPE_ESPTOUCH_AIRKISS</a>
 }<tr class="separator:ga533261c0af94cdbb04fe90f452af9b9d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga9537246ce540bc1e1a294de687d488bf"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__Smartconfig__APIs.html#ga9537246ce540bc1e1a294de687d488bf">smartconfig_get_version</a> (void)</td></tr>
<tr class="memdesc:ga9537246ce540bc1e1a294de687d488bf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the version of SmartConfig.  <a href="#ga9537246ce540bc1e1a294de687d488bf">More...</a><br /></td></tr>
<tr class="separator:ga9537246ce540bc1e1a294de687d488bf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga390ec2c5af28b29044899c8ffd016b04"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__Smartconfig__APIs.html#ga390ec2c5af28b29044899c8ffd016b04">smartconfig_start</a> (<a class="el" href="group__Smartconfig__APIs.html#ga98fdb334fead4d1bd026b9ceee8c3db0">sc_callback_t</a> cb,...)</td></tr>
<tr class="memdesc:ga390ec2c5af28b29044899c8ffd016b04"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start SmartConfig mode.  <a href="#ga390ec2c5af28b29044899c8ffd016b04">More...</a><br /></td></tr>
<tr class="separator:ga390ec2c5af28b29044899c8ffd016b04"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga85819fc5109441eae24e4262ca34bd48"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__Smartconfig__APIs.html#ga85819fc5109441eae24e4262ca34bd48">smartconfig_stop</a> (void)</td></tr>
<tr class="memdesc:ga85819fc5109441eae24e4262ca34bd48"><td class="mdescLeft">&#160;</td><td class="mdescRight">Stop SmartConfig, free the buffer taken by smartconfig_start.  <a href="#ga85819fc5109441eae24e4262ca34bd48">More...</a><br /></td></tr>
<tr class="separator:ga85819fc5109441eae24e4262ca34bd48"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga068b054aecdba51c0ea5219089d5b3c0"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__Smartconfig__APIs.html#ga068b054aecdba51c0ea5219089d5b3c0">esptouch_set_timeout</a> (uint8 time_s)</td></tr>
<tr class="memdesc:ga068b054aecdba51c0ea5219089d5b3c0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set timeout of SmartConfig.  <a href="#ga068b054aecdba51c0ea5219089d5b3c0">More...</a><br /></td></tr>
<tr class="separator:ga068b054aecdba51c0ea5219089d5b3c0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga14d5f55176a12436d58014272f6df156"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__Smartconfig__APIs.html#ga14d5f55176a12436d58014272f6df156">smartconfig_set_type</a> (<a class="el" href="group__Smartconfig__APIs.html#ga533261c0af94cdbb04fe90f452af9b9d">sc_type</a> type)</td></tr>
<tr class="memdesc:ga14d5f55176a12436d58014272f6df156"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set protocol type of SmartConfig.  <a href="#ga14d5f55176a12436d58014272f6df156">More...</a><br /></td></tr>
<tr class="separator:ga14d5f55176a12436d58014272f6df156"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>SmartConfig APIs. </p>
<p>SmartConfig can only be enabled in station only mode. Please make sure the target AP is enabled before enable SmartConfig. </p>
<h2 class="groupheader">Typedef Documentation</h2>
<a class="anchor" id="ga98fdb334fead4d1bd026b9ceee8c3db0"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef void(* sc_callback_t) (<a class="el" href="group__Smartconfig__APIs.html#gafec33e52eaa14ed795ab28ce69c685e3">sc_status</a> status, void *pdata)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>The callback of SmartConfig, executed when smart-config status changed. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sc_status</td><td>status : status of SmartConfig:<ul>
<li>if status == SC_STATUS_GETTING_SSID_PSWD, parameter void *pdata is a pointer of sc_type, means SmartConfig type: AirKiss or ESP-TOUCH.</li>
<li>if status == SC_STATUS_LINK, parameter void *pdata is a pointer of struct <a class="el" href="structstation__config.html">station_config</a>;</li>
<li>if status == SC_STATUS_LINK_OVER, parameter void *pdata is a pointer of mobile phone's IP address, 4 bytes. This is only available in ESPTOUCH, otherwise, it is NULL.</li>
<li>otherwise, parameter void *pdata is NULL. </li>
</ul>
</td></tr>
    <tr><td class="paramname">void</td><td>*pdata : data of SmartConfig</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>null </dd></dl>

</div>
</div>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a class="anchor" id="gafec33e52eaa14ed795ab28ce69c685e3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__Smartconfig__APIs.html#gafec33e52eaa14ed795ab28ce69c685e3">sc_status</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="ggafec33e52eaa14ed795ab28ce69c685e3a3de75e54ab5d15e0aa697d2d35adc363"></a>SC_STATUS_WAIT&#160;</td><td class="fielddoc">
<p>waiting, do not start connection in this phase </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ggafec33e52eaa14ed795ab28ce69c685e3a30fee0de55f059ac14821f8e2b22ac03"></a>SC_STATUS_FIND_CHANNEL&#160;</td><td class="fielddoc">
<p>find target channel, start connection by APP in this phase </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ggafec33e52eaa14ed795ab28ce69c685e3aefc9b644b16531defe122b7316cea0c0"></a>SC_STATUS_GETTING_SSID_PSWD&#160;</td><td class="fielddoc">
<p>getting SSID and password of target AP </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ggafec33e52eaa14ed795ab28ce69c685e3aae1dcaae9b8358bd43499bbca2e0bf95"></a>SC_STATUS_LINK&#160;</td><td class="fielddoc">
<p>connecting to target AP </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ggafec33e52eaa14ed795ab28ce69c685e3a1ae1253a12888c150c36cd30f56394dc"></a>SC_STATUS_LINK_OVER&#160;</td><td class="fielddoc">
<p>got IP, connect to AP successfully </p>
</td></tr>
</table>

</div>
</div>
<a class="anchor" id="ga533261c0af94cdbb04fe90f452af9b9d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__Smartconfig__APIs.html#ga533261c0af94cdbb04fe90f452af9b9d">sc_type</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="gga533261c0af94cdbb04fe90f452af9b9dabae45491cc05b00bd1b069bb61e37b01"></a>SC_TYPE_ESPTOUCH&#160;</td><td class="fielddoc">
<p>protocol: ESPTouch </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="gga533261c0af94cdbb04fe90f452af9b9da6254d899f4bf164fdb0f3dd778c206e9"></a>SC_TYPE_AIRKISS&#160;</td><td class="fielddoc">
<p>protocol: AirKiss </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="gga533261c0af94cdbb04fe90f452af9b9da50e8065c00b088cdb87b8b0ded4a853c"></a>SC_TYPE_ESPTOUCH_AIRKISS&#160;</td><td class="fielddoc">
<p>protocol: ESPTouch and AirKiss </p>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga068b054aecdba51c0ea5219089d5b3c0"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool esptouch_set_timeout </td>
          <td>(</td>
          <td class="paramtype">uint8&#160;</td>
          <td class="paramname"><em>time_s</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set timeout of SmartConfig. </p>
<dl class="section attention"><dt>Attention</dt><dd>SmartConfig timeout start at SC_STATUS_FIND_CHANNEL, SmartConfig will restart if timeout.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">uint8</td><td>time_s : range 15s~255s, offset:45s.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true : succeed </dd>
<dd>
false : fail </dd></dl>

</div>
</div>
<a class="anchor" id="ga9537246ce540bc1e1a294de687d488bf"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const char* smartconfig_get_version </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get the version of SmartConfig. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">null</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>SmartConfig version </dd></dl>

</div>
</div>
<a class="anchor" id="ga14d5f55176a12436d58014272f6df156"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool smartconfig_set_type </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__Smartconfig__APIs.html#ga533261c0af94cdbb04fe90f452af9b9d">sc_type</a>&#160;</td>
          <td class="paramname"><em>type</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set protocol type of SmartConfig. </p>
<dl class="section attention"><dt>Attention</dt><dd>If users need to set the SmartConfig type, please set it before calling smartconfig_start.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sc_type</td><td>type : AirKiss, ESP-TOUCH or both.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true : succeed </dd>
<dd>
false : fail </dd></dl>

</div>
</div>
<a class="anchor" id="ga390ec2c5af28b29044899c8ffd016b04"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool smartconfig_start </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__Smartconfig__APIs.html#ga98fdb334fead4d1bd026b9ceee8c3db0">sc_callback_t</a>&#160;</td>
          <td class="paramname"><em>cb</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>...</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Start SmartConfig mode. </p>
<p>Start SmartConfig mode, to connect ESP8266 station to AP, by sniffing for special packets from the air, containing SSID and password of desired AP. You need to broadcast the SSID and password (e.g. from mobile device or computer) with the SSID and password encoded.</p>
<dl class="section attention"><dt>Attention</dt><dd>1. This api can only be called in station mode. </dd>
<dd>
2. During SmartConfig, ESP8266 station and soft-AP are disabled. </dd>
<dd>
3. Can not call smartconfig_start twice before it finish, please call smartconfig_stop first. </dd>
<dd>
4. Don't call any other APIs during SmartConfig, please call smartconfig_stop first.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sc_callback_t</td><td>cb : SmartConfig callback; executed when SmartConfig status changed; </td></tr>
    <tr><td class="paramname">uint8</td><td>log : 1, UART output logs; otherwise, UART only outputs the result.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true : succeed </dd>
<dd>
false : fail </dd></dl>

</div>
</div>
<a class="anchor" id="ga85819fc5109441eae24e4262ca34bd48"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool smartconfig_stop </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Stop SmartConfig, free the buffer taken by smartconfig_start. </p>
<dl class="section attention"><dt>Attention</dt><dd>Whether connect to AP succeed or not, this API should be called to free memory taken by smartconfig_start.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">null</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true : succeed </dd>
<dd>
false : fail </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Mar 1 2016 10:19:26 for ESP8266_RTOS_SDK by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.10
</small></address>
</body>
</html>
